import 'package:flutter/material.dart';

class TextBaseWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('Text基本属性')),
        body: SingleChildScrollView(
            child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            SizedBox(height: 8),
            Text('文字居左: textAlign: TextAlign.left', textAlign: TextAlign.left),
            Text('文字居中: textAlign: TextAlign.center',
                textAlign: TextAlign.center),
            Text('文字居右: textAlign: TextAlign.right',
                textAlign: TextAlign.right),
            Text('文字向两侧对齐: textAlign: TextAlign.justify textAlign',
                textAlign: TextAlign.justify),
            Text('TextDirection.ltr + TextAlign.start',
                textAlign: TextAlign.start, textDirection: TextDirection.ltr),
            Text('TextDirection.rtl + TextAlign.start',
                textAlign: TextAlign.start, textDirection: TextDirection.rtl),
            Text('TextDirection.ltr + TextAlign.end',
                textAlign: TextAlign.end, textDirection: TextDirection.ltr),
            Text('TextDirection.rtl + TextAlign.end',
                textAlign: TextAlign.end, textDirection: TextDirection.rtl),
            Text('是否换行, 默认为true, 设置false会只显示一行abcdefghijklkjlkjlkjlkj',
                softWrap: false),
            Text(
              'overflow: TextOverflow.ellipsis: 超出一行最大宽度时长度显示...超出一行最大宽度时长度显示...超出一行最大宽度时长度显示...,overflow: TextOverflow.ellipsis',
              softWrap: false,
              overflow: TextOverflow.ellipsis,
            ),
            Text(
              'overflow: TextOverflow.clip: 超出一行最大宽度时长度截断超出超出一行最大宽度时长度截断超出超出一行最大宽度时长度截断超出超出一行最大宽度时长度截断超出',
              softWrap: false,
              overflow: TextOverflow.clip,
            ),
            Text(
              'overflow: TextOverflow.fade: 超出一行最大宽度时长度时尾部出现隐藏渐变色超出一行最大宽度时长度时尾部出现隐藏渐变色超出一行最大宽度时长度时尾部出现隐藏渐变色',
              softWrap: false,
              overflow: TextOverflow.fade,
            ),
            Text(
              'overflow: TextOverflow.visible: 在容器外渲染文本内容,不推荐Render overflowing text outside of its container',
              softWrap: false,
              overflow: TextOverflow.visible,
            ),
            Text('textScaleFactor: 字体像素 = textScaleFactor * 逻辑像素.',
                textScaleFactor: 1.5),
            Text('最多三行:\nline1\nline2\nline3\nline4', maxLines: 3),
            Text.rich(TextSpan(
                text: 'Hello',
                style: TextStyle(color: Colors.red),
                children: [
                  TextSpan(
                    text: 'wor',
                    style: TextStyle(color: Colors.green),
                  ),
                  TextSpan(
                    text: 'ld!',
                    style: TextStyle(color: Colors.blue),
                  )
                ]))
          ],
        )));
  }
}
